package administrator;

import java.awt.EventQueue;


public class Admn_Menu {

	public JFrame frame;
	public JTextField textField;
	public String username;
	
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Admn_Menu window = new Admn_Menu();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	
	public Admn_Menu() {
		initialize();
		//Display();
	}

	
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(375, 150, 500, 450);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JButton btnStudentDetails = new JButton("Student Details");
		btnStudentDetails.setBounds(177, 291, 130, 23);
		frame.getContentPane().add(btnStudentDetails);
		
		JButton btnQuestionPaper = new JButton("Question Paper");
		btnQuestionPaper.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				
				btnQuestionPaperActionPerformed(evt);
			}
		});
		btnQuestionPaper.setBounds(177, 328, 130, 23);
		frame.getContentPane().add(btnQuestionPaper);
		
		JButton btnNewButton = new JButton("Test Schedule");
		btnNewButton.setBounds(177, 189, 130, 23);
		frame.getContentPane().add(btnNewButton);
		
		JButton btnResults = new JButton("Results");
		btnResults.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnResultActionPerformed(evt);
			}
		});
		btnResults.setBounds(177, 223, 130, 23);
		frame.getContentPane().add(btnResults);
		
		JLabel lblAdministratorMenu = new JLabel("ADMINISTRATOR MENU");
		lblAdministratorMenu.setFont(new Font("Tahoma", Font.BOLD, 16));
		lblAdministratorMenu.setHorizontalAlignment(SwingConstants.CENTER);
		lblAdministratorMenu.setBounds(10, 46, 464, 45);
		frame.getContentPane().add(lblAdministratorMenu);
		
		JButton btnMail = new JButton("Mail");
		btnMail.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnMailActionPerformed(evt);
			}
		});
		btnMail.setBounds(177, 257, 130, 23);
		frame.getContentPane().add(btnMail);
		
		JLabel lblWelcome = new JLabel("Welcome");
		lblWelcome.setFont(new Font("Tahoma", Font.BOLD, 14));
		lblWelcome.setHorizontalAlignment(SwingConstants.CENTER);
		lblWelcome.setBounds(75, 102, 175, 23);
		frame.getContentPane().add(lblWelcome);
		
		textField = new JTextField();
		textField.setFont(new Font("Tahoma", Font.BOLD, 14));
		textField.setBackground(UIManager.getColor("Button.background"));
		textField.setEditable(false);
		textField.setBounds(260, 105, 154, 29);
		frame.getContentPane().add(textField);
		textField.setColumns(10);
		
		JButton btnSignOut = new JButton("Sign Out");
		btnSignOut.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnSignOutActionPerformed(evt);
			}
		});
		btnSignOut.setBounds(197, 378, 89, 23);
		frame.getContentPane().add(btnSignOut);
	}
	
		public void Display(String s)
		{
			textField.setText(s);
			username = s;
		}
	
		private void btnResultActionPerformed(java.awt.event.ActionEvent evt) 
		{
			
			SelectedStudents ss = new SelectedStudents();
			ss.frame.setVisible(true);
			this.frame.setVisible(false);
			ss.display();
		}
		
		private void btnQuestionPaperActionPerformed(java.awt.event.ActionEvent evt) 
		{
			QuesSetUp qs = new QuesSetUp();
			qs.frame.setVisible(true);
			this.frame.setVisible(false);
		}
		
		private void btnSignOutActionPerformed(java.awt.event.ActionEvent evt) 
		{
			Admin_Login al = new Admin_Login();
			al.frame.setVisible(true);
			this.frame.setVisible(false);
		}
		
		private void btnMailActionPerformed(java.awt.event.ActionEvent evt)
		{
			SendMail sm = new SendMail();
			sm.frame.setVisible(true);
			this.frame.setVisible(false);
		}
	
}
